#ifndef __CubicBezierPatch_h__
#define __CubicBezierPatch_h__

#include "dkglMatrix4.h"

using namespace DKGL;

class CubicBezierPatch
{
public:

	CubicBezierPatch();
	CubicBezierPatch(const Vector3 ctrl_pts[16]);	// row major
	~CubicBezierPatch();

	void Draw();
	void SetCtrlPt(unsigned int id, Vector3 pt);
	inline Vector3 GetCtrlPt(unsigned int id) { return mCtrlPts[id]; };

	void SetResUV(unsigned int u, unsigned int v) { mResU = u; mResV = v; mNeedUpdate = true; };
	void SetResU(unsigned int u) { mResU = u; mNeedUpdate = true; };
	void SetResV(unsigned int v) { mResV = v; mNeedUpdate = true; };

private:

	Vector3 mCtrlPts[16];
	unsigned int mResU, mResV;

	Vector3 *mVertBuf;

	bool mNeedUpdate;
	void _updateVertBuf();

};

#endif